package com.zhuss.controller.meeting;

import com.zhuss.bean.bo.meeting.apply.*;
import com.zhuss.common.BaseController;
import com.zhuss.common.OperateService;
import com.zhuss.exception.WpsException;
import com.zhuss.meeting.apply.ApplyOperateServiceExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: zhushanshuo
 * @Date: 2020/2/12 21:29
 */
@RestController
@RequestMapping("/apply")
public class ApplyOperateController extends BaseController{

    @Autowired
    @Qualifier("applyOperateService")
    private OperateService<Void, Object> applyOperateService;

    @Autowired
    @Qualifier("applyOperateServiceExt")
    private ApplyOperateServiceExt applyOperateServiceExt;

    /**
     * 新建
     * @param bo
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/create")
    public void create(@RequestBody CreateApplyBo bo) throws WpsException {
        applyOperateService.create(bo);
    }

    /**
     * 编辑
     * @param bo
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/update")
    public void update(@RequestBody UpdateApplyBo bo) throws WpsException {
        applyOperateService.update(bo);
    }

    /**
     * 删除
     * @param bo
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/delete")
    public void delete(@RequestBody DeleteApplyBo bo) throws WpsException {
        applyOperateService.delete(bo);
    }

    /**
     * 确认使用会议室
     * @param bo
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/applyUse")
    public void applyUse(@RequestBody UseApplyBo bo) throws WpsException {
        applyOperateServiceExt.applyUse(bo);
    }

    /**
     * 取消使用会议室
     * @param bo
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/applyCancel")
    public void applyCancel(@RequestBody CancelApplyBo bo) throws WpsException {
        applyOperateServiceExt.applyCancel(bo);
    }

    /**
     * 会议室评价
     * @param bo
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/applyEvaluate")
    public void applyEvaluate(@RequestBody EvaluateApplyBo bo) throws WpsException {
        applyOperateServiceExt.applyEvaluate(bo);
    }

    /**
     * 更换会议室
     * @param bo
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/applyChange")
    public void applyChange(@RequestBody ChangeApplyBo bo) throws WpsException {
        applyOperateServiceExt.applyChange(bo);
    }

    /**
     * 提交会议室申请
     * @param bo
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/applySubmit")
    public void applySubmit(@RequestBody SubmitApplyBo bo) throws WpsException {
        applyOperateServiceExt.applySubmit(bo);
    }

    /**
     * 撤销会议室申请
     * @param bo
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/applyRevoke")
    public void applyRevoke(@RequestBody RevokeApplyBo bo) throws WpsException {
        applyOperateServiceExt.applyRevoke(bo);
    }
}
